#ifndef GAMEMANAGER_H
#define GAMEMANAGER_H
#include "units.h"
#include <QPointF>
#include <QVector>
#include <QPainter>
#include <QElapsedTimer>
class GameManager : public QObject
{
    Q_OBJECT

public:
    static GameManager& instance();
    void init();
    void paintUnits(QPainter&) const;
    void start();
private:
    GameManager();
    GameManager(const GameManager&) = delete;

    void initTimer_createrUnits();
    void initTimer_updateSimulator();
    void initSimulator();
    void updateSimulator();
    void rebuildSimulator();

    void checkCollisions();
private:
    QVector<Player> _players;
    QVector<Unit> _units_team1;
    QVector<Unit> _units_team2;

    RVO::RVOSimulator* _simulator;
    QTimer* _timer_updateSimulator;

    QTimer* _timer_createrUnits;
    QElapsedTimer eTimer;
};

#endif // GAMEMANAGER_H
